# $Id: Makefile.in,v 1.129 2021/07/03 15:45:33 tom Exp $
##############################################################################
# Copyright 2020,2021 Thomas E. Dickey                                       #
# Copyright 1998-2017,2018 Free Software Foundation, Inc.                    #
#                                                                            #
# Permission is hereby granted, free of charge, to any person obtaining a    #
# copy of this software and associated documentation files (the "Software"), #
# to deal in the Software without restriction, including without limitation  #
# the rights to use, copy, modify, merge, publish, distribute, distribute    #
# with modifications, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the  #
# following conditions:                                                      #
#                                                                            #
# The above copyright notice and this permission notice shall be included in #
# all copies or substantial portions of the Software.                        #
#                                                                            #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
# DEALINGS IN THE SOFTWARE.                                                  #
#                                                                            #
# Except as contained in this notice, the name(s) of the above copyright     #
# holders shall not be used in advertising or otherwise to promote the sale, #
# use or other dealings in this Software without prior written               #
# authorization.                                                             #
##############################################################################
#
# Author: Thomas E. Dickey 1996-on
#
# Makefile for ncurses tests.

# turn off _all_ suffix rules; we'll generate our own
.SUFFIXES:

SHELL		= @SHELL@
VPATH		= @srcdir@

@SET_MAKE@

destdir		=
x		= @EXEEXT@
o		= .@OBJEXT@

MODEL		= ../@DFT_OBJ_SUBDIR@
top_srcdir	= @top_srcdir@
srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@
datarootdir	= @datarootdir@

bindir		= @bindir@
libdir		= @libdir@
includedir	= @includedir@
includesubdir	= @includesubdir@
datarootdir	= @datarootdir@
datadir		= @datadir@

BINDIR		= $(DESTDIR)$(bindir)
LIBDIR		= $(DESTDIR)$(libdir)
INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
DATADIR		= $(DESTDIR)$(datadir)

PACKAGE		= @PACKAGE@

LIBTOOL		= @LIBTOOL@
LIBTOOL_OPTS	= @LIBTOOL_OPTS@
LIBTOOL_CLEAN	= @LIB_CLEAN@
LIBTOOL_COMPILE	= @LIB_COMPILE@
LIBTOOL_LINK	= @LIB_LINK@

INSTALL		= @INSTALL@ @INSTALL_OPT_O@
INSTALL_PROG	= @INSTALL_PROGRAM@ @INSTALL_OPT_S@
INSTALL_SCRIPT	= @INSTALL_SCRIPT@
INSTALL_DATA	= @INSTALL_DATA@
transform	= @program_transform_name@
TRANSFORM	= sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'

CTAGS		= @CTAGS@
ETAGS		= @ETAGS@

CC		= @CC@
CPP		= @CPP@

CFLAGS		= @CFLAGS@ @EXTRA_CFLAGS@
CPPFLAGS	= -I. -I$(srcdir) -I../test -DHAVE_CONFIG_H -DDATA_DIR=\"$(datadir)\" @CPPFLAGS@

CCFLAGS		= $(CPPFLAGS) $(CFLAGS)

CFLAGS_LIBTOOL	= $(CCFLAGS)
CFLAGS_NORMAL	= $(CCFLAGS) -DNCURSES_STATIC
CFLAGS_DEBUG	= $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE
CFLAGS_PROFILE	= $(CCFLAGS) -DNCURSES_STATIC -pg
CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@

CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)

REL_VERSION	= @cf_cv_rel_version@
ABI_VERSION	= @cf_cv_abi_version@
LOCAL_LIBDIR	= @top_builddir@/lib
LOCAL_LIBS	= @TEST_DEPS@
MATH_LIB	= @MATH_LIB@
TEST_LIBS	= @TEST_LIBS@

LD		= @LD@
LINK		= @LINK_TESTS@ $(LIBTOOL_LINK) $(CFLAGS)

LDFLAGS		= @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@

LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@

TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@

# use these for linking with all of the libraries
LIBS_DEFAULT	= $(TEST_ARGS) @LIBS@ $(TEST_LIBS)
LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_DEFAULT)

# use these for linking with the (n)curses library and possibly pthreads
LIBS_THREADS	= `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-l@FORM_NAME@.*-l@PANEL_NAME@[^ ]*//'` $(TEST_LIBS) @PTHREAD@
LDFLAGS_THREADS	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_THREADS)

# use these for linking with the (n)curses library
LIBS_CURSES	= `echo "$(TEST_ARGS) @LIBS@" | sed -e 's/-l@FORM_NAME@.*-l@PANEL_NAME@[^ ]*//'` $(TEST_LIBS)
LDFLAGS_CURSES	= $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES)

# use these when we need the math library
LDFLAGS_CURSES_M= $(LDFLAGS_CURSES) $(MATH_LIB)

# use these for linking with the tinfo library if we have it, or curses library if not
LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LIBS@ $(TEST_LIBS)
LDFLAGS_TINFO	= @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)

LINT		= @LINT@
LINT_OPTS	= @LINT_OPTS@
LINT_LIBS	= -lform -lmenu -lpanel -lncurses @LIBS@

INCDIR		= $(top_srcdir)/include
incdir		= ../include

HEADER_DEPS	= \
	$(incdir)/curses.h \
	$(incdir)/term.h \
	$(incdir)/ncurses_cfg.h \
	$(incdir)/ncurses_def.h \
	$(incdir)/ncurses_dll.h \
	$(incdir)/term.h \
	$(incdir)/unctrl.h \
	$(INCDIR)/nc_alloc.h

################################################################################

@MAKE_PHONY@.PHONY :	all
@MAKE_PHONY@.PHONY :	check

all::

# Verify that each header-file can be compiled without including another.
check::
	@$(SHELL) -c "for header in *.h;\
		do \
			echo \"** testing \$${header}\" ; \
			echo \"#include <\$${header}>\" >headers.c; \
			echo \"int main(void) { return 0; }\" >>headers.c; \
			$(CC) -c $(CFLAGS) $(CPPFLAGS) headers.c; \
		done"
	-@rm -f headers.*

# The rest is generated from the "programs" and "modules" files...
